<template>
  <div class="app-container home">
    <el-row :gutter="20">
      <el-col :sm="24" :lg="12" style="padding-left: 20px">
        <h1>欢迎使用人力资源小程序</h1>
        <h3>本程序主要角色有三种：求职者、员工、管理员，主要职责分别如下。</h3>
        <p>
          <b>求职者(一般用户)：</b>注册并填写个人基本信息。一般用户可以随意修改自己的个人信息与账号密码。还可以查询自己的面试情况。<br />
          <b>员工(特殊用户)：</b>由管理者手动修改一般用户性质添加。特殊用户同一般用户，可以随意修改个人信息与账号密码。还可以申请、查询预支工资。
          特殊用户还细分为：“正式员工”和“小时工”。正式员工一般不可以预支工资，但可以向管理者申请预支工资的权限。小时工在任职满7天后可以预支工资。<br />
          <b>管理员(管理者)：</b>管理者可以从已注册的一般用户中筛选人才进行面试。当面试通过时，由管理者修改用户性质，并为其分配工作厂区与岗位。管理者可以管理用户预支工资的权限和当次预支申请的通过与否。还可以辞退员工。
        </p>
      </el-col>
      <el-col :sm="24" :lg="12" style="padding-left: 50px">
        <el-row>
          <el-col :span="12">
            <h2>技术选型</h2>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="6">
            <h4>后端技术</h4>
            <ul>
              <li>SpringBoot</li>
              <li>Spring Security</li>
              <li>JWT</li>
              <li>MyBatis</li>
              <li>Druid</li>
              <li>Fastjson</li>
              <li>...</li>
            </ul>
          </el-col>
          <el-col :span="6">
            <h4>前端技术</h4>
            <ul>
              <li>Vue</li>
              <li>Vuex</li>
              <li>Element-ui</li>
              <li>Axios</li>
              <li>Sass</li>
              <li>Quill</li>
              <li>...</li>
            </ul>
          </el-col>
        </el-row>
      </el-col>
    </el-row>
    <el-divider />
    <el-row :gutter="20">
      <el-form :model="queryParams" ref="queryRef" :inline="true" label-width="68px">
        <el-form-item label="日期范围" prop="times">
          <el-date-picker type="daterange" v-model="queryParams.times" format="YYYY-MM-DD" value-format="YYYY-MM-DD"
            :style="{ width: '100%' }" start-placeholder="开始日期" end-placeholder="结束日期"
            range-separator="至"></el-date-picker>
        </el-form-item>
        <el-form-item>
          <el-button type="primary" icon="Search" @click="count">查询</el-button>
        </el-form-item>
        <div class="box home-sku-sale-stats bgc2">
          <div class="header">
            <div class="title">
              任职&离职人数
            </div>
          </div>
          <div class="body">
            <div class="stats">
              <div class="item">
                <div class="num color3 text-shadow2">
                  {{ data.queryParams.activeCount }}
                </div>
                <div class="text color4">在职人数</div>
              </div>
            </div>
            <div class="stats">
              <div class="item">
                <div class="num color3 text-shadow2">
                  {{ data.queryParams.resignedCount }}
                </div>
                <div class="text color4">
                  离职人数
                </div>
              </div>
            </div>
          </div>
        </div>

      </el-form>
    </el-row>
  </div>
</template>

<script setup name="Index">
import { countRecord ,countDef } from "@/api/manage/record";
import { reactive } from 'vue';

const data = reactive({
  form: {},
  queryParams: {
    times: [],
    startDate: null,
    endDate: null,
    activeCount: 0,
    resignedCount: 0
  },
  rules: {
  }
});
const { queryParams } = toRefs(data);

function count() {
  countRecord(queryParams.value).then(response => {
    console.log(response);
    data.queryParams.activeCount = response.activeCount;
    data.queryParams.resignedCount = response.resignedCount;
  });
}

function def() {
  countDef(queryParams.value).then(response => {
    data.queryParams.activeCount = response.activeCount;
    data.queryParams.resignedCount = response.resignedCount;
  });
}

def()
</script>
<style scoped lang="scss">
.home {
  blockquote {
    padding: 10px 20px;
    margin: 0 0 20px;
    font-size: 17.5px;
    border-left: 5px solid #eee;
  }

  hr {
    margin-top: 20px;
    margin-bottom: 20px;
    border: 0;
    border-top: 1px solid #eee;
  }

  .col-item {
    margin-bottom: 20px;
  }

  ul {
    padding: 0;
    margin: 0;
  }

  font-family: "open sans",
  "Helvetica Neue",
  Helvetica,
  Arial,
  sans-serif;
  font-size: 13px;
  color: #676a6c;
  overflow-x: hidden;

  ul {
    list-style-type: none;
  }

  h4 {
    margin-top: 0px;
  }

  h2 {
    margin-top: 10px;
    font-size: 26px;
    font-weight: 100;
  }

  p {
    margin-top: 10px;

    b {
      font-weight: 700;
    }
  }

  .update-log {
    ol {
      display: block;
      list-style-type: decimal;
      margin-block-start: 1em;
      margin-block-end: 1em;
      margin-inline-start: 0;
      margin-inline-end: 0;
      padding-inline-start: 40px;
    }
  }
}

/**离职人数统计 */

.home-sku-sale-stats {
  display: flex;
  flex-direction: column;
  height: calc((100vh - 120px) * 0.2);
  min-height: 166px;
  background: #E9F3FF;
  border-radius: 20px;

  .header {
    display: flex;

    .el-icon {
      cursor: pointer;
    }

    .title {
      flex: 1;
      display: flex;
      align-items: center;
      justify-content: center;
      height: 50px;
      font-size: 18px;
      font-family: PingFangSC-Semibold, PingFang SC;
      font-weight: 300;
      text-shadow: 2px 4px 7px rgba(85, 132, 255, 0.5);
    }
  }

  .body {
    flex: 1;
    display: flex;

    .stats {
      flex: 1;
      display: flex;
      align-items: center;
      justify-content: center;

      .item {
        display: inline-flex; // 关键点
        flex-direction: column;

        .num {
          height: 50px;
          font-size: 36px;
          font-family: PingFangSC-Semibold, PingFang SC;
          font-weight: 600;
          line-height: 50px;
          text-shadow: 2px 4px 7px rgba(85, 132, 255, 0.5);
        }

        .text {
          height: 17px;
          margin-top: 3px;
          font-size: 12px;
          font-family: PingFangSC-Regular, PingFang SC;
          font-weight: 400;
          color: #91a7dc;
          line-height: 17px;
        }

        .color1 {
          color: #072074;
        }

        .color2 {
          color: #91a7dc;
        }

        .color3 {
          color: #ff5757;
        }

        .color4 {
          color: #de9690;
        }

        .text-shadow1 {
          text-shadow: 2px 4px 7px rgba(85, 132, 255, 0.5);
        }

        .text-shadow2 {
          text-shadow: 2px 4px 7px rgba(255, 99, 85, 0.5);
        }
      }
    }

  }
}
</style>
